{template '_header'}



<div class="page-heading"> <h2><i class="fa fa-circle-o"></i>会员等级管理</h2> </div>

<form action="./index.php" method="get" class="form-horizontal form-search" role="form">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="ewei_shopv2" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r"  value="member.level" />
    <div class="page-toolbar row m-b-sm m-t-sm">
        <div class="col-sm-4">

            <div class="input-group-btn">
                <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
                {ifp 'member.level.edit'}
                <button class="btn btn-default btn-sm" type="button" data-toggle='batch' data-href="{php echo webUrl('member/level/enabled',array('enabled'=>1))}"><i class='fa fa-circle'></i> 启用</button>
                <button class="btn btn-default btn-sm" type="button" data-toggle='batch'  data-href="{php echo webUrl('member/level/enabled',array('enabled'=>0))}"><i class='fa fa-circle-o'></i> 禁用</button>
                {/if}
                {ifp 'member.level.delete'}
                <button class="btn btn-default btn-sm" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('member/level/delete')}"><i class='fa fa-trash'></i> 删除</button>
                {/if}

                {ifp 'member.level.add'}
                <a class='btn btn-primary btn-sm' href="{php echo webUrl('member/level/add')}"><i class='fa fa-plus'></i> 添加会员等级</a>
                {/if}
            </div>
        </div>


        <div class="col-sm-6 pull-right">

            <select name="enabled" class='form-control input-sm select-sm'>
                <option value="" {if $_GPC['enabled'] == ''} selected{/if}>状态</option>
                <option value="1" {if $_GPC['enabled']== '1'} selected{/if}>启用</option>
                <option value="0" {if $_GPC['enabled'] == '0'} selected{/if}>禁用</option>
            </select>
            <div class="input-group">
                <input type="text" class="input-sm form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="请输入关键词"> <span class="input-group-btn">

                                     <button class="btn btn-sm btn-primary" type="submit"> 搜索</button> </span>
            </div>

        </div>
    </div>
</form>

<form action="" method="post" >


    <table class="table table-hover table-responsive">
        <thead>
        <tr>
            <th style="width:25px;"><input type='checkbox' /></th>
            <th style="width:60px;">等级</th>
            <th>等级名称</th>
            <th style="width:80px;">折扣</th>

            <th>升级条件</th>
            <th style="width:80px;">状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {loop $list $row}


        <tr {if $row['id']=='default'}style='background:#eee;{if !empty($_GPC['keyword'])}display:none;{/if}'{/if}>
        <td>{if $row['id']!='default'}

            <input type='checkbox'   value="{$row['id']}"/>
            {/if}
        </td>

        <td>
            {if $row['id']=='default'}
            --
            {else}
            {$row['level']}
            {/if}
        </td>

        <td>{$row['levelname']}</td>
        <td>{$row['discount']}</td>
        <td>
            {if $row['id']=='default'}
            默认等级
            {else}

            {if empty($shopset['leveltype'])}
            {if $row['ordermoney']>0}
            完成订单金额满 {$row['ordermoney']}元
            {else}
            不自动升级
            {/if}
            {/if}
            {if $shopset['leveltype']==1}
            {if $row['ordercount']>0}
            完成订单数量满 {$row['ordercount']}个
            {else}
            不自动升级
            {/if}
            {/if}
            {/if}
        </td>
        <td>
            {if $row['id']!='default'}
            <span class='label {if $row['enabled']==1}label-success{else}label-default{/if}'
            {ifp 'member.level.edit'}
            data-toggle='ajaxSwitch'
            data-switch-value='{$row['enabled']}'
            data-switch-value0='0|禁用|label label-default|{php echo webUrl('member/level/enabled',array('enabled'=>1,'id'=>$row['id']))}'
            data-switch-value1='1|启用|label label-success|{php echo webUrl('member/level/enabled',array('enabled'=>0,'id'=>$row['id']))}'
            {/if}
            >
            {if $row['enabled']==1}启用{else}禁用{/if}</span>
            {/if}


        </td>
        <td>

            {ifp 'member.level.view|member.level.edit'}<a href="{php echo webUrl('member/level/edit', array('id' => $row['id']))}" class="btn btn-default btn-sm"
                ><i class='fa fa-edit'></i> {ifp 'member.level.edit'}修改{else}查看{/if}</a>{/if}
            {if $row['id']!='default'}
            {ifp 'member.level.delete'}<a data-toggle='ajaxRemove' href="{php echo webUrl('member/level/delete', array('id' => $row['id']))}"class="btn btn-default btn-sm" data-confirm='确认要删除此会员等级吗?'><i class="fa fa-trash"></i> 删除</a>{/if}
            {/if}


            </tr>
            {/loop}

        </tbody>
    </table>

</form>

{template '_footer'}
